package cn.gson.crm.controller.counselor;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.StudentPoDao;
import cn.gson.crm.model.entity.Employee;
import cn.gson.crm.model.po.FollowStudentPo;

@WebServlet("/counselor/dofavor")
public class CustomerDofavorServlet extends BaseServlet{
	/**
	 * 查看协助信息
	 */
	private static final long serialVersionUID = 1L;
	private StudentPoDao stuPoDao = new StudentPoDao();
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		Employee emp = (Employee) request.getSession().getAttribute("emplo");
		String id = request.getParameter("id");
		String p = request.getParameter("page");
		if(p==null||p.isEmpty()){
			p="1";
		}
		Integer page = Integer.parseInt(p);
		//获取学员信息
		FollowStudentPo po = stuPoDao.getStudentInfo(id);
		//根据学员id查询学员记录信息
		List<FollowStudentPo> stuRecordList = stuPoDao.getAssistRecord(page, id);
		Integer totalPage = stuPoDao.getAssistTotalPage(id);
		request.setAttribute("totalPage", totalPage);
		request.setAttribute("page", page);
		request.setAttribute("queryString", noPageQueryString(request));
		request.setAttribute("stuRecordList", stuRecordList);
		request.setAttribute("stuDetail", po);
		request.setAttribute("emp", emp);
		getServletPathAndForward(request, "counselor/cus_detail.jsp");
	}
}
